import React, { Component } from 'react';
import { List } from 'antd-mobile'
import { CalendarOutline, FileWrongOutline, ChatCheckOutline, CollectMoneyOutline } from 'antd-mobile-icons'
import { withRouter } from 'react-router-dom'
import { good_favlist } from '../../utils/api'
import { connect } from 'react-redux'
class MyMain extends Component {
    // state = {
    //     collectlist: []
    // }
    handleCollect() {
        // console.log(this.props);
        this.props.history.push('/collect')
    }
    // componentDidMount() {
    //     var userinfo = localStorage.getItem('userinfo')
    //     good_favlist({ userid: userinfo.id }).then((res) => {
    //         this.setState({ collectlist: res.data.list })
    render(){
        return (
            <div className='mymain'>
                <div className='center'>
                    <div onClick={() => { this.handleCollect() }}>
                        <span>{this.props.collectlist.length}</span>
                        <span>收藏</span>
                    </div>
                    <div><span>0</span>
                        <span>积分</span>
                    </div>
                    <div><span>0</span>
                        <span>优惠券</span></div>
                </div>
                <div className='myorder'>
                    <div className='title'>
                        <span className='order'>我的订单</span>
                        <span>查看全部订单 > </span>
                    </div>
                    <div className='deal'>
                        <div>
                            <span><CalendarOutline /></span>
                            <span>待付款</span>
                        </div>
                        <div>
                            <span><FileWrongOutline /></span>
                            <span>待发货</span>
                        </div>
                        <div>
                            <span><ChatCheckOutline /></span>
                            <span>已发货</span>
                        </div>
                        <div>
                            <span><CollectMoneyOutline /></span>
                            <span>待评价</span>
                        </div>
                    </div>
                </div>
                <div className='member'>
                    <List>
                        <List.Item onClick={() => { }}>
                            会员中心
                        </List.Item>
    
                    </List>
                </div>
                <div className='function'>
                    <List>
                        <List.Item onClick={() => { }}>
                            领券中心
                        </List.Item>
                        <List.Item onClick={() => { }}>
                            我的评价
                        </List.Item>
                        <List.Item onClick={() => { }}>
                            收货地址
                        </List.Item>
                        <List.Item onClick={() => { }}>
                            我的客服
                        </List.Item>
                    </List>
                </div>
            </div>
        )
    }
    //     })
}


export default connect(
    (state) => {
        return {
            collectlist: state.collectlist
        }
    },
    (dispatch) => {
        return {

        }
    }
)(withRouter(MyMain))
// withRouter(MyMain);